/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package javaapplication1.dos;

/**
 *
 * @author abelitro
 */
public class SaveMe {

    transient int x;
    int y;

    public SaveMe(int xVal, int yVal) {
        x = xVal;
        y = yVal;
    }

    public int hashCode() {
        return (int) Math.pow(x, y);
    }

    public boolean equals(Object o) {
        SaveMe test = (SaveMe) o;
        if (test.y == y && test.x == x) {
            return true;
        } else {
            return false;
        }
    }

    public static void main(String[] args) {
        SaveMe init = new SaveMe(3, 4);
        SaveMe init2 = new SaveMe(4,3);
        String papel="papel";
        System.out.println("hascode: " + init.hashCode());
        System.out.println("equals: " + init.equals(init));
        System.out.println("hascode de init2: " + init2.hashCode());
        System.out.print("init 1 es igual a init 2 : "+init.equals(papel));
    }
}
